package com.veer.shop.controller;

import java.util.concurrent.TimeUnit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.veer.shop.utils.RedisUtil;

/**
 * 测试控制器
 * @author Administrator
 *
 */

@RestController
public class TestController {
	
	@Autowired
	RedisUtil redisUtil;
	// 测试接口
	@RequestMapping("/test")
	public String test() {
		return "hello2";
	}
	
	@RequestMapping("/writeRedis")
	public String writeRedis() {
		redisUtil.setEx("file.path", "D:////", 300, TimeUnit.SECONDS);
		return "success";
	}
	
	@RequestMapping("/getRedis")
	public String getRedis(@RequestParam(name = "key") String key) {
		
		return redisUtil.get("file.path");
	}
}
